package com.max.common.oauth.oauth20;

import java.io.Serializable;

import org.json.JSONObject;

import com.max.common.util.HttpTool.Response;

@SuppressWarnings("serial")
public class AccessToken implements Serializable
{

	private String access_token;
	
	private String expires_in;
	
	private String refresh_token;

	public AccessToken(Response response) 
	{
		if(response != null)
		{
			try
			{
				JSONObject json = response.asJSONObject();
				access_token = json.getString("access_token");
				expires_in = json.getString("expires_in");
				refresh_token = json.getString("refresh_token");
			}
			catch(Exception e)
			{
				e.printStackTrace();
			}
		}
	}

	public AccessToken(String accessToken, String expiresIn, String refreshToken) 
	{
		access_token = accessToken;
		expires_in = expiresIn;
		refresh_token = refreshToken;
	}

	
	public String getAccess_token() 
	{
		return access_token;
	}

	public void setAccess_token(String accessToken) 
	{
		access_token = accessToken;
	}

	public String getExpires_in() 
	{
		return expires_in;
	}

	public void setExpires_in(String expiresIn) 
	{
		expires_in = expiresIn;
	}

	public String getRefresh_token() 
	{
		return refresh_token;
	}

	public void setRefresh_token(String refreshToken) 
	{
		refresh_token = refreshToken;
	}
}
